package com.java.converter;

import com.java.pojo.InRoomInfoBean;
import org.springframework.core.convert.converter.Converter;

/**
 * 配置类型转换
 */
public class InRoomInfoBeanConverter implements Converter<String, InRoomInfoBean> {

    public InRoomInfoBean convert(String s) {
        String[] split = s.split("-");
        InRoomInfoBean inRoomInfoBean = null;
        if (split.length==2){
            inRoomInfoBean = new InRoomInfoBean();
            inRoomInfoBean.setCreateDate(split[0]);
            inRoomInfoBean.setCustomerName(split[1]);
            inRoomInfoBean.setGender(split[2]);
            inRoomInfoBean.setIdcard(split[3]);
            inRoomInfoBean.setIsVip(split[4]);
            inRoomInfoBean.setMoney(Float.parseFloat(split[5]));
            inRoomInfoBean.setPhone(split[6]);
            inRoomInfoBean.setRoomId(Long.parseLong(split[7]));
        }
        return inRoomInfoBean;
    }
}